/*
 *  particleSystem.cpp
 *  mograph
 *
 *  Created by parktvadmin on 11/3/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include "particleSystem.h"

ParticleSystem::ParticleSystem() {
	particleNum = 1000;
	initParticles();
	//for(int i = 0; i < particleNum; i++){
		//particles[i] = Particle(ofPoint(100, ofGetHeight()-100));
	//}
}

ParticleSystem::ParticleSystem(int num) {
	particleNum = num;
	initParticles();
	//particles = new Particle[particleNum];
	//for(int i = 0; i < particleNum; i++){
	//	particles[i] = Particle(ofPoint(100, ofGetHeight()-100));
	//}
}

void ParticleSystem::draw() {
	for (list<Particle>::iterator particle = particles.begin(); particle != particles.end(); particle++) { //list<Particle>::iterator it = particles.begin(); it != particles.end(); it++
		particle->update();
		particle->draw();	
	}
	//for(int i = 0; i < particleNum; i++){
	//	particles[i].update();
	//	particles[i].draw();
	//}
}

void ParticleSystem::initParticles(){
	for (int i = 0; i<particleNum; i++)
		particles.push_back(Particle(ofPoint(100, ofGetHeight()-100)));
}